#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define P 233
#define MOD 1000000007
using namespace std;
int lstr1,lstr2;
unsigned long long int hash1[1001];
unsigned long long int hash2[1001];
unsigned long long int p[1001];
char str1[1001];
char str2[1001];
void gethash()
{
	
	hash1[0] = str1[0];
	hash2[0] = str2[0];
	for(int i = 1;i<lstr1;i++)
	{
		hash1[i] = (hash1[i-1]*P+str1[i])%MOD;
	}
	for(int i = 1;i<lstr2;i++)
	{
		hash2[i] = (hash2[i-1]*P+str2[i])%MOD;
		//printf("**%d\n",hash2[i]);
	}
}
int main()
{
	
	int ans,flag;
	p[0]=1;
	for(int i = 1;i<=1001;i++)
	{
		p[i] = p[i-1]*P; 
		//printf("%d\n",p[i]);
	} 
	while(scanf(" %s",str1)!=EOF)
	{
		ans = 0;
		if(strcmp(str1,"#")==0) return 0;
		scanf("%s",str2);
		lstr1 = strlen(str1);
		lstr2 = strlen(str2);
		gethash();
		for(int i=0;i<=lstr1-lstr2;)
		{
			flag = 0;
			if(i==0)
			{
				if(hash1[lstr2-1]==hash2[lstr2-1])
				{
					ans++;
					flag = 1;
				}
			}
			else
			{
				
				long long int temp;
				temp = hash1[i+lstr2-1]-(hash1[i-1]*p[lstr2])%MOD;
			//	printf("%d %d\n",temp,hash2[lstr2-1]);
				if(temp==hash2[lstr2-1])
				{
					flag = 1;
					//printf("****\n");
					ans++;
				}
			}
			if(flag) i = i+lstr2;
			else i++;
		}
		printf("%d\n",ans);
	}
} 
